package com.jeady.timetodo.activities

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.jeady.jxcompose.ClickEffect.longClickSaveToDCIM
import com.jeady.timetodo.R

class FutureActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val backgroundColor = Color(0xff200010)
        window.statusBarColor = backgroundColor.toArgb()
        setContent {
            // A surface container using the 'background' color from the theme
            Surface(
                modifier = Modifier.fillMaxSize(),
                color = MaterialTheme.colorScheme.background
            ) {
                val context = LocalContext.current
                Box(Modifier.fillMaxSize()
                    .background(Brush.verticalGradient(
                        0.0f to backgroundColor,
                        1.0f to backgroundColor.copy(red = 0.5f)
                    )), contentAlignment = Alignment.Center
                ){
                    Column(
                        Modifier
                            .fillMaxWidth(0.9f)
                            .padding(10.dp),
                        horizontalAlignment = Alignment.CenterHorizontally
                    ){
                        Text("关注公众号，留下你想要的功能", color = Color(0xffeeeeee))
                        Surface(Modifier, shape = RoundedCornerShape(10.dp), shadowElevation = 5.dp) {
                            Image(
                                painter = painterResource(id = R.drawable.gzh),
                                contentDescription = "关注公众号",
                                Modifier.longClickSaveToDCIM(context, R.drawable.gzh).padding(10.dp)
                            )
                        }
                        Text("承接各种程序设计，公众号回复'项目合作'，我们深入讨论",
                            color=Color(0xff40a02f), fontWeight = FontWeight.SemiBold
                        )
                    }
                }
            }
        }
    }
}